package provide;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import utils.RabbitMqUtils;

import java.io.IOException;

public class Provider {
    //路由名称
    private static final String EXCHANGE = "direct_routing";

    public static void main(String[] args) throws IOException {
        Connection connection = RabbitMqUtils.getConnection();
        Channel channel = connection.createChannel();

        try {
            for (int i = 0; i < 10; i++) {
                //发送消息
                channel.basicPublish(EXCHANGE, "microsoft", null, ("msg" + i).getBytes());
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            RabbitMqUtils.close(connection, channel);
        }


    }

}
